﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TeamRanking
{
    public class Team
    {
        public static Team teamInstance;
        public static Team GetInstance()
        {
            if (teamInstance == null)
            {
                teamInstance = new Team();
            }
            return teamInstance;
        }
           
        private string name;
        public string Name
        {
            get { return name; }
            set
            {
                if (value == "")
                    name = "Team";
                else
                    name = value;
            }
        }

        private int wins;
        public int Wins 
        { 
            get { return wins; }
            set 
            {
                if (value > 12)
                    wins = 12;
                else if (value < 0)
                    wins = 0;
                else
                    wins = value;
            }
        }

        private int losses;
        public int Losses 
        {
            get { return losses; }
            set
            {
                if ((this.Wins + value) > 12)
                    losses = (12 - wins);
                else if (value < 0)
                    losses = (12 - wins);
                else
                    losses = value;
            }
        }

        private int ties;
        public int Ties 
        {
            get { return ties; }
            set
            {
                if ((this.Wins + this.Losses + value) > 12)
                    ties = (12 - wins - losses);
                else if (value < 0)
                    ties = (12 - wins - losses);
                else
                    ties = value;
            }
        }

        private int points;
        public int Points 
        { 
            get { return points; }
            set
            {
                if (value < 0)
                    points = 0;
                else
                    points = value;
            }
        }

        private int pointsAllowed;
        public int PointsAllowed
        {
            get { return pointsAllowed; }
            set
            {
                if (value < 0)
                    pointsAllowed = 0;
                else
                    pointsAllowed = value;
            }
        }

        private double offensiveYards;
        public double OffensiveYards 
        {
            get { return offensiveYards; }
            set
            {
                if (value > 10000)
                    offensiveYards = 10000;
                else
                    offensiveYards = value;
            }
        }

        private double defensiveYards;
        public double DefensiveYards
        {
            get { return defensiveYards; }
            set
            {
                if (value > 10000)
                    defensiveYards = 10000;
                else
                    defensiveYards = value;
            }
        }

        private int rank;
        public int Rank 
        { 
            get { return rank; }

            set
            {
                rank = value;
            }
        }
    }
}
